package main.java.command;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务员
 * 请求者角色
 */
public class Waitor {
    //持有多个命令对象
    private List<Command> commandList =new ArrayList<>();

    public void setCommand (Command command){
        commandList.add(command);
    }

    public void orderUp(){
        System.out.println("订单来了");

        for (Command command : commandList) {
            if(command != null){
                command.execute();
            }
        }
    }
}
